package com.threeti.mecool.core.domain.model;

import com.threeti.mecool.core.domain.model.acl.User;
import com.threeti.mecool.core.domain.model.project.Project;
import com.threeti.mecool.core.domain.model.project.ProjectStore;
import com.threeti.mecool.framework.domain.support.DefaultDomainEntity;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.Date;

/**
 * 沟通
 */
@Entity
@Table(name = "DM_COMMUNICATION")
public class Communication extends DefaultDomainEntity {

    @ManyToOne
    @JoinColumn(name = "USER_ID")
    private User user;

    @ManyToOne
    private Project project;

    @ManyToOne
    private ProjectStore projectStore;

    private String title;
    private String type;
    private String contactName;
    private String contactPosition;
    private String contactPhoneOrOther;
    private String content;

    private Date recordDate = new Date();

    public Communication(User user, Project project, ProjectStore projectStore, String title, String contactName, String content) {
        this.user = user;
        this.project = project;
        this.projectStore = projectStore;
        this.title = title;
        this.contactName = contactName;
        this.content = content;
    }

    /**
     * 进行沟通的用户(一般即督导)
     */
    public User getUser() {
        return user;
    }

    /**
     * 所在项目
     */
    public Project getProject() {
        return project;
    }

    /**
     * 所关联的(项目下的)终端门店
     */
    public ProjectStore getProjectStore() {
        return projectStore;
    }

    /**
     * 标题
     */
    public String getTitle() {
        return title;
    }

    /**
     * 沟通方式
     */
    public String getType() {
        return type;
    }

    /**
     * 联系人姓名
     */
    public String getContactName() {
        return contactName;
    }

    /**
     * 联系人职位
     */
    public String getContactPosition() {
        return contactPosition;
    }

    /**
     * 联系方式(最可能是电话)
     */
    public String getContactPhoneOrOther() {
        return contactPhoneOrOther;
    }

    /**
     * 沟通内容
     */
    public String getContent() {
        return content;
    }

    /**
     * 记录时间
     */
    public Date getRecordDate() {
        return recordDate;
    }

    @Override
    public String toString() {
        return "Communication [title=" + title + ", type=" + type + ", contactName=" + contactName + ", contactPosition=" + contactPosition
                + ", contactPhoneOrOther=" + contactPhoneOrOther + ", content=" + content + ", recordDate=" + recordDate + "]";
    }

    public Communication() {
        super();
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public void setContactPosition(String contactPosition) {
        this.contactPosition = contactPosition;
    }

    public void setContactPhoneOrOther(String contactPhoneOrOther) {
        this.contactPhoneOrOther = contactPhoneOrOther;
    }

    public void setContent(String content) {
        this.content = content;
    }

}
